3.1 \(\int \frac{(a+b \csc (x)) (A+B \csc (x)+C \csc ^2(x))}{\sqrt{\csc (x)}} \, dx\)

Optimal. Leaf size=112 \[ -\frac{2}{3} \sqrt{\sin (x)} \sqrt{\csc (x)} \text{EllipticF}\left (\frac{\pi }{4}-\frac{x}{2},2\right ) (3 a B+3 A b+b C)+2 \sqrt{\sin (x)} \sqrt{\csc (x)} E\left (\left .\frac{\pi }{4}-\frac{x}{2}\right |2\right ) (b B-a (A-C))-2 \cos (x) \sqrt{\csc (x)} (a C+b B)-\frac{2}{3} b C \cos (x) \csc ^{\frac{3}{2}}(x) \]

[Out]

-2*(b*B + a*C)*Cos[x]*Sqrt[Csc[x]] - (2*b*C*Cos[x]*Csc[x]^(3/2))/3 + 2*(b*B - a*(A - C))*Sqrt[Csc[x]]*Elliptic
E[Pi/4 - x/2, 2]*Sqrt[Sin[x]] - (2*(3*A*b + 3*a*B + b*C)*Sqrt[Csc[x]]*EllipticF[Pi/4 - x/2, 2]*Sqrt[Sin[x]])/3

________________________________________________________________________________________

Rubi [A]  time = 0.180087, antiderivative size = 112, normalized size of antiderivative = 1., number of steps used = 7, number of rules used = 6, integrand size = 25, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.24, Rules used = {4076, 4047, 3771, 2641, 4046, 2639} \[ -\frac{2}{3} \sqrt{\sin (x)} \sqrt{\csc (x)} F\left (\left .\frac{\pi }{4}-\frac{x}{2}\right |2\right ) (3 a B+3 A b+b C)+2 \sqrt{\sin (x)} \sqrt{\csc (x)} E\left (\left .\frac{\pi }{4}-\frac{x}{2}\right |2\right ) (b B-a (A-C))-2 \cos (x) \sqrt{\csc (x)} (a C+b B)-\frac{2}{3} b C \cos (x) \csc ^{\frac{3}{2}}(x) \]

Antiderivative was successfully verified.

[In]

Int[((a + b*Csc[x])*(A + B*Csc[x] + C*Csc[x]^2))/Sqrt[Csc[x]],x]

[Out]

-2*(b*B + a*C)*Cos[x]*Sqrt[Csc[x]] - (2*b*C*Cos[x]*Csc[x]^(3/2))/3 + 2*(b*B - a*(A - C))*Sqrt[Csc[x]]*Elliptic
E[Pi/4 - x/2, 2]*Sqrt[Sin[x]] - (2*(3*A*b + 3*a*B + b*C)*Sqrt[Csc[x]]*EllipticF[Pi/4 - x/2, 2]*Sqrt[Sin[x]])/3

Rule 4076

Int[((A_.) + csc[(e_.) + (f_.)*(x_)]*(B_.) + csc[(e_.) + (f_.)*(x_)]^2*(C_.))*(csc[(e_.) + (f_.)*(x_)]*(d_.))^
(n_.)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_)), x_Symbol] :> -Simp[(b*C*Csc[e + f*x]*Cot[e + f*x]*(d*Csc[e + f*x
])^n)/(f*(n + 2)), x] + Dist[1/(n + 2), Int[(d*Csc[e + f*x])^n*Simp[A*a*(n + 2) + (B*a*(n + 2) + b*(C*(n + 1)
+ A*(n + 2)))*Csc[e + f*x] + (a*C + B*b)*(n + 2)*Csc[e + f*x]^2, x], x], x] /; FreeQ[{a, b, d, e, f, A, B, C,
n}, x] &&  !LtQ[n, -1]

Rule 4047

Int[(csc[(e_.) + (f_.)*(x_)]*(b_.))^(m_.)*((A_.) + csc[(e_.) + (f_.)*(x_)]*(B_.) + csc[(e_.) + (f_.)*(x_)]^2*(
C_.)), x_Symbol] :> Dist[B/b, Int[(b*Csc[e + f*x])^(m + 1), x], x] + Int[(b*Csc[e + f*x])^m*(A + C*Csc[e + f*x
]^2), x] /; FreeQ[{b, e, f, A, B, C, m}, x]

Rule 3771

Int[(csc[(c_.) + (d_.)*(x_)]*(b_.))^(n_), x_Symbol] :> Dist[(b*Csc[c + d*x])^n*Sin[c + d*x]^n, Int[1/Sin[c + d
*x]^n, x], x] /; FreeQ[{b, c, d}, x] && EqQ[n^2, 1/4]

Rule 2641

Int[1/Sqrt[sin[(c_.) + (d_.)*(x_)]], x_Symbol] :> Simp[(2*EllipticF[(1*(c - Pi/2 + d*x))/2, 2])/d, x] /; FreeQ
[{c, d}, x]

Rule 4046

Int[(csc[(e_.) + (f_.)*(x_)]*(b_.))^(m_.)*(csc[(e_.) + (f_.)*(x_)]^2*(C_.) + (A_)), x_Symbol] :> -Simp[(C*Cot[
e + f*x]*(b*Csc[e + f*x])^m)/(f*(m + 1)), x] + Dist[(C*m + A*(m + 1))/(m + 1), Int[(b*Csc[e + f*x])^m, x], x]
/; FreeQ[{b, e, f, A, C, m}, x] && NeQ[C*m + A*(m + 1), 0] &&  !LeQ[m, -1]

Rule 2639

Int[Sqrt[sin[(c_.) + (d_.)*(x_)]], x_Symbol] :> Simp[(2*EllipticE[(1*(c - Pi/2 + d*x))/2, 2])/d, x] /; FreeQ[{
c, d}, x]

Rubi steps

\begin{align*} \int \frac{(a+b \csc (x)) \left (A+B \csc (x)+C \csc ^2(x)\right )}{\sqrt{\csc (x)}} \, dx &=-\frac{2}{3} b C \cos (x) \csc ^{\frac{3}{2}}(x)+\frac{2}{3} \int \frac{\frac{3 a A}{2}+\frac{1}{2} (3 A b+3 a B+b C) \csc (x)+\frac{3}{2} (b B+a C) \csc ^2(x)}{\sqrt{\csc (x)}} \, dx\\ &=-\frac{2}{3} b C \cos (x) \csc ^{\frac{3}{2}}(x)+\frac{2}{3} \int \frac{\frac{3 a A}{2}+\frac{3}{2} (b B+a C) \csc ^2(x)}{\sqrt{\csc (x)}} \, dx+\frac{1}{3} (3 A b+3 a B+b C) \int \sqrt{\csc (x)} \, dx\\ &=-2 (b B+a C) \cos (x) \sqrt{\csc (x)}-\frac{2}{3} b C \cos (x) \csc ^{\frac{3}{2}}(x)+(-b B+a (A-C)) \int \frac{1}{\sqrt{\csc (x)}} \, dx+\frac{1}{3} \left ((3 A b+3 a B+b C) \sqrt{\csc (x)} \sqrt{\sin (x)}\right ) \int \frac{1}{\sqrt{\sin (x)}} \, dx\\ &=-2 (b B+a C) \cos (x) \sqrt{\csc (x)}-\frac{2}{3} b C \cos (x) \csc ^{\frac{3}{2}}(x)-\frac{2}{3} (3 A b+3 a B+b C) \sqrt{\csc (x)} F\left (\left .\frac{\pi }{4}-\frac{x}{2}\right |2\right ) \sqrt{\sin (x)}+\left ((-b B+a (A-C)) \sqrt{\csc (x)} \sqrt{\sin (x)}\right ) \int \sqrt{\sin (x)} \, dx\\ &=-2 (b B+a C) \cos (x) \sqrt{\csc (x)}-\frac{2}{3} b C \cos (x) \csc ^{\frac{3}{2}}(x)+2 (b B-a (A-C)) \sqrt{\csc (x)} E\left (\left .\frac{\pi }{4}-\frac{x}{2}\right |2\right ) \sqrt{\sin (x)}-\frac{2}{3} (3 A b+3 a B+b C) \sqrt{\csc (x)} F\left (\left .\frac{\pi }{4}-\frac{x}{2}\right |2\right ) \sqrt{\sin (x)}\\ \end{align*}

Mathematica [A]  time = 0.74282, size = 133, normalized size = 1.19 \[ -\frac{4 (a+b \csc (x)) \left (A+B \csc (x)+C \csc ^2(x)\right ) \left (\sqrt{\sin (x)} \text{EllipticF}\left (\frac{1}{4} (\pi -2 x),2\right ) (3 a B+3 A b+b C)-3 \sqrt{\sin (x)} E\left (\left .\frac{1}{4} (\pi -2 x)\right |2\right ) (a (C-A)+b B)+3 a C \cos (x)+3 b B \cos (x)+b C \cot (x)\right )}{3 \csc ^{\frac{5}{2}}(x) (a \sin (x)+b) (A (-\cos (2 x))+A+2 B \sin (x)+2 C)} \]

Antiderivative was successfully verified.

[In]

Integrate[((a + b*Csc[x])*(A + B*Csc[x] + C*Csc[x]^2))/Sqrt[Csc[x]],x]

[Out]

(-4*(a + b*Csc[x])*(A + B*Csc[x] + C*Csc[x]^2)*(3*b*B*Cos[x] + 3*a*C*Cos[x] + b*C*Cot[x] - 3*(b*B + a*(-A + C)
)*EllipticE[(Pi - 2*x)/4, 2]*Sqrt[Sin[x]] + (3*A*b + 3*a*B + b*C)*EllipticF[(Pi - 2*x)/4, 2]*Sqrt[Sin[x]]))/(3
*Csc[x]^(5/2)*(b + a*Sin[x])*(A + 2*C - A*Cos[2*x] + 2*B*Sin[x]))

________________________________________________________________________________________

Maple [A]  time = 1.643, size = 204, normalized size = 1.8 \begin{align*} -{\frac{1}{3\,\cos \left ( x \right ) } \left ( \left ( 6\,bB+6\,Ca \right ) \sin \left ( x \right ) \left ( \cos \left ( x \right ) \right ) ^{2}+\sqrt{\sin \left ( x \right ) +1}\sqrt{-2\,\sin \left ( x \right ) +2}\sqrt{-\sin \left ( x \right ) } \left ( 6\,A{\it EllipticE} \left ( \sqrt{\sin \left ( x \right ) +1},1/2\,\sqrt{2} \right ) a-3\,A{\it EllipticF} \left ( \sqrt{\sin \left ( x \right ) +1},1/2\,\sqrt{2} \right ) a-3\,A{\it EllipticF} \left ( \sqrt{\sin \left ( x \right ) +1},1/2\,\sqrt{2} \right ) b-6\,B{\it EllipticE} \left ( \sqrt{\sin \left ( x \right ) +1},1/2\,\sqrt{2} \right ) b-3\,B{\it EllipticF} \left ( \sqrt{\sin \left ( x \right ) +1},1/2\,\sqrt{2} \right ) a+3\,B{\it EllipticF} \left ( \sqrt{\sin \left ( x \right ) +1},1/2\,\sqrt{2} \right ) b-6\,C{\it EllipticE} \left ( \sqrt{\sin \left ( x \right ) +1},1/2\,\sqrt{2} \right ) a+3\,C{\it EllipticF} \left ( \sqrt{\sin \left ( x \right ) +1},1/2\,\sqrt{2} \right ) a-C{\it EllipticF} \left ( \sqrt{\sin \left ( x \right ) +1},{\frac{\sqrt{2}}{2}} \right ) b \right ) \sin \left ( x \right ) +2\,Cb \left ( \cos \left ( x \right ) \right ) ^{2} \right ) \left ( \sin \left ( x \right ) \right ) ^{-{\frac{3}{2}}}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a+b*csc(x))*(A+B*csc(x)+C*csc(x)^2)/csc(x)^(1/2),x)

[Out]

-1/3/sin(x)^(3/2)*((6*B*b+6*C*a)*sin(x)*cos(x)^2+(sin(x)+1)^(1/2)*(-2*sin(x)+2)^(1/2)*(-sin(x))^(1/2)*(6*A*Ell
ipticE((sin(x)+1)^(1/2),1/2*2^(1/2))*a-3*A*EllipticF((sin(x)+1)^(1/2),1/2*2^(1/2))*a-3*A*EllipticF((sin(x)+1)^
(1/2),1/2*2^(1/2))*b-6*B*EllipticE((sin(x)+1)^(1/2),1/2*2^(1/2))*b-3*B*EllipticF((sin(x)+1)^(1/2),1/2*2^(1/2))
*a+3*B*EllipticF((sin(x)+1)^(1/2),1/2*2^(1/2))*b-6*C*EllipticE((sin(x)+1)^(1/2),1/2*2^(1/2))*a+3*C*EllipticF((
sin(x)+1)^(1/2),1/2*2^(1/2))*a-C*EllipticF((sin(x)+1)^(1/2),1/2*2^(1/2))*b)*sin(x)+2*C*b*cos(x)^2)/cos(x)

________________________________________________________________________________________

Maxima [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int \frac{{\left (C \csc \left (x\right )^{2} + B \csc \left (x\right ) + A\right )}{\left (b \csc \left (x\right ) + a\right )}}{\sqrt{\csc \left (x\right )}}\,{d x} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*csc(x))*(A+B*csc(x)+C*csc(x)^2)/csc(x)^(1/2),x, algorithm="maxima")

[Out]

integrate((C*csc(x)^2 + B*csc(x) + A)*(b*csc(x) + a)/sqrt(csc(x)), x)

________________________________________________________________________________________

Fricas [F]  time = 0., size = 0, normalized size = 0. \begin{align*}{\rm integral}\left (\frac{C b \csc \left (x\right )^{3} +{\left (C a + B b\right )} \csc \left (x\right )^{2} + A a +{\left (B a + A b\right )} \csc \left (x\right )}{\sqrt{\csc \left (x\right )}}, x\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*csc(x))*(A+B*csc(x)+C*csc(x)^2)/csc(x)^(1/2),x, algorithm="fricas")

[Out]

integral((C*b*csc(x)^3 + (C*a + B*b)*csc(x)^2 + A*a + (B*a + A*b)*csc(x))/sqrt(csc(x)), x)

________________________________________________________________________________________

Sympy [F(-1)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Timed out} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*csc(x))*(A+B*csc(x)+C*csc(x)**2)/csc(x)**(1/2),x)

[Out]

Timed out

________________________________________________________________________________________

Giac [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int \frac{{\left (C \csc \left (x\right )^{2} + B \csc \left (x\right ) + A\right )}{\left (b \csc \left (x\right ) + a\right )}}{\sqrt{\csc \left (x\right )}}\,{d x} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*csc(x))*(A+B*csc(x)+C*csc(x)^2)/csc(x)^(1/2),x, algorithm="giac")

[Out]

integrate((C*csc(x)^2 + B*csc(x) + A)*(b*csc(x) + a)/sqrt(csc(x)), x)